//
//  ViewController.m
//  blockChangeColor
//
//  Created by izhifei-Devon on 2017/6/7.
//  Copyright © 2017年 izhifei-Devon. All rights reserved.
//

#import "ViewController.h"
#import "ViewController1.h"

@interface ViewController ()

@property(nonatomic,strong)UIButton * button;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    _button = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 80, 30)];
    [self.view addSubview:_button];
    [_button setTitle:@"下一页" forState:UIControlStateNormal];
    [_button setBackgroundColor:[UIColor blueColor]];
    [_button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [_button addTarget:self action:@selector(nextView) forControlEvents:UIControlEventTouchUpInside];
    // Do any additional setup after loading the view, typically from a nib.
}
-(void)nextView{
    ViewController1 * vc = [[ViewController1 alloc]init];
    //回调修改颜色
    vc.changeBackgroudColor = ^(NSString * str,UIColor * color) {
        
        [_button setTitle:str forState:UIControlStateNormal];
        self.view.backgroundColor = color;
    };
    [self.navigationController pushViewController:vc animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
